<?php

namespace Models;

/**
 * Description of User
 *
 * @author Admin
 */
class User extends \Core\Base\Table
{
	
	public function auth($login, $pass)
	{
		$row = $this->_db->selectRow('SELECT * FROM user WHERE (login = ? OR email = ?) AND password = ?', $login, $login, $pass);

		if($row && isset($row['id']))
		{
			$session = new \Core\Session('auth');
			$session->info = $row;
			
			return true;
		}
		
		return false;
	}
	
	public function logout()
	{
		$session = new \Core\Session('auth');
		$session->destruct();
	}
	
}
